
from celery import shared_task
from django.core.mail import send_mail
from django.conf import settings



@shared_task
def send_register_active_email(to_email, username, token):
    """发送激活邮件"""
    subject = "欢迎注册激活云易购"
    message = ""
    html_message = (
        "<h1>%s, 欢迎成为云易购注册会员<h1>"
        "请点击下面链接激活账户<br/>"
        '<a href="http://127.0.0.1:8000/user/active/%s">'
        "http://127.0.0.1:8000/user/active/%s</a>" % (username, token, token)
    )
    sender = settings.EMAIL_FROM
    receiver = [to_email]
    print(receiver,"ddddddddddddddd")
    send_mail(
        subject,
        message=message,
        from_email=sender,
        recipient_list=receiver,
        html_message=html_message,
        fail_silently=False,
    )